package StringAlgorithms;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

class Solver1297
{	char[] Rec,RvRec;
	int bound,M=600001,B=52;
	int[] FwHash,BkHash,Mod;

	public void Input() throws IOException
	{	StreamTokenizer in=new StreamTokenizer(new InputStreamReader(System.in));
		in.nextToken();String str=in.sval;
		
		Rec=str.toCharArray();
		RvRec=new char[Rec.length];
		for (int i=0;i<Rec.length;i++)
			RvRec[i]=Rec[Rec.length-1-i];
		FwHash=new int[Rec.length];
		BkHash=new int[Rec.length];
		
		bound=Rec.length;
		Mod=new int[bound];Mod[0]=1;
		for (int i=1;i<=Mod.length-1;i++)
			Mod[i]=(Mod[i-1]*B)%M;
	}
	private int Cv(char c)
	{	if (c<='z' && c>='a')
			return c-'a';
		else
			return 26+(int)(c-'A');
	}
	private boolean NaiveMatch(int nChar,char[] S1,int i,char[] S2,int j)
	{	for (int k=0;k<nChar;k++)
			if (S1[i+k]!=S2[j+k]) return false;
		return true;
	}
	private int HashIt(int prev,char[] S,int index,int nChar)
	{	int rs=0;
		rs=prev-((Cv(S[index-1])*Mod[nChar-1])%M);
		rs=(rs+M)%M;
		rs=(rs*B+Cv(S[index+nChar-1]))%M;
		return rs;
	}
	private int PreHash(char[] S,int nChar)
	{	int rs=0;
		for (int i=0;i<nChar;i++)
			rs=(rs*B+Cv(S[i]))%M;
		return rs;
	}
	public void Solve()
	{	int index=-1,nChar=0;
		LOGIC:
		for (int i=bound;i>=0;i--)
		{	FwHash[0]=PreHash(Rec,i);
			BkHash[0]=PreHash(RvRec,i);
			for (int j=1;j+(i-1)<=Rec.length-1;j++)
			{	FwHash[j]=HashIt(FwHash[j-1],Rec,j,i);
				BkHash[j]=HashIt(BkHash[j-1],RvRec,j,i);
			}
			for (int j=0;j+(i-1)<=Rec.length-1;j++)
			{	//j+nChar-1		Rec.length-j-nChar
				if (FwHash[j]==BkHash[Rec.length-j-i])
				{	if (NaiveMatch(i,Rec,j,RvRec,Rec.length-j-i))
					{	index=j;nChar=i;
						break LOGIC;
					}
				}
			}	
		}
		Output(index,nChar);
	}
	public void Output(int index,int nChar)
	{	char[] rs=new char[nChar];
		for (int i=0;i<nChar;i++)
			rs[i]=Rec[index+i];
		System.out.println(rs);
	}
	public void main() throws IOException
	{	Input();
		Solve();
	}
}
public class P1297
{	public static void main(String[] args) throws IOException
	{	Solver1297 solver =new Solver1297();
		solver.main();
	}
}
